import requests
import re
for i in range(0,250,25):
    url = f'https://movie.douban.com/top250?start={i}&filter='
    header = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4621.0 Safari/537.36'
    }
    f = requests.get(url ,headers=header)
    f.encoding = 'utf-8'
    html = f.text
    # print(html)
    obj = re.compile(r'<div class="item">.*?<span class="title">(?P<name>.*?)'
                     r'</span>.*?<br>(?P<year>.*?)&nbsp.*? <span class="rating_num"'
                     r' property="v:average">(?P<score>.*?)</span>.*?'
                     r'<span>(?P<num>.*?)人评价</span>',re.S)
    result = obj.finditer(html)
    for item in result:
        dic = item.groupdict()
        dic["year"] = dic['year'].strip()
        print(list(dic.values()))